home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1993 / Internet Info CD-ROM (Walnut Creek) (1993).iso / networking / osi / isode / dosisode / DOSISODE80.ZIP / ISODE8.WRK / UNIX / LIB / DNS / NETBYADD.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-09  |  1.5 KB  |  44 lines

  1. #include <fiddle.h>
  2. /*
  3.  * Copyright (c) 1983 Regents of the University of California.
  4.  * All rights reserved.
  5.  *
  6.  * Redistribution and use in source and binary forms are permitted
  7.  * provided that: (1) source distributions retain this entire copyright
  8.  * notice and comment, and (2) distributions including binaries display
  9.  * the following acknowledgement:  ``This product includes software
  10.  * developed by the University of California, Berkeley and its contributors''
  11.  * in the documentation or other materials provided with the distribution
  12.  * and in all advertising materials mentioning features or use of this
  13.  * software. Neither the name of the University nor the names of its
  14.  * contributors may be used to endorse or promote products derived
  15.  * from this software without specific prior written permission.
  16.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  17.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  18.  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  19.  */
  20.  
  21. #if defined(LIBC_SCCS) && !defined(lint)
  22. static char sccsid[] = "@(#)getnetbyaddr.c    5.7 (Berkeley) 6/1/90";
  23. #endif /* LIBC_SCCS and not lint */
  24.  
  25. #include <netdb.h>
  26.  
  27. extern int _net_stayopen;
  28.  
  29. struct netent *
  30. getnetbyaddr(net, type)
  31.     register long net;
  32.     register int type;
  33. {
  34.     register struct netent *p;
  35.  
  36.     setnetent(_net_stayopen);
  37.     while (p = getnetent())
  38.         if (p->n_addrtype == type && p->n_net == net)
  39.             break;
  40.     if (!_net_stayopen)
  41.         endnetent();
  42.     return (p);
  43. }
  44.